export default {
	showModal(title, options) {
		let config = {
			title: title
		}
		options = options || {}
		Object.assign(config, options)
		return new Promise((resolve, reject) => {
			config.success = (res) => {
				if (res.confirm) {
					return resolve()
				} else if (res.cancel) {
					return reject()
				}
			}
			config.fail = () => {
				return reject()
			}
			uni.showModal(config)
		})
	},
	
	showToast(title, options) {
		let config = {
			title: title,
		    icon: 'none'
		}
		options = options || {}
		Object.assign(config, options)
		return new Promise((resolve, reject) => {
			config.success = (res) => {
				return resolve()
			}
			config.fail = () => {
				return reject()
			}
			
			uni.showToast(config)
		})
	}
}
